package ly.gupao.edu.interview;

import java.util.Scanner;

/**
 * 输入xyz、由小到大输出这三个数
 */
public class OrderNumber {

    static void orderNumAsc(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < i; j++) {
                if (arr[i] < arr[j]) {
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }

        System.out.print("排序后的顺序为：");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + ",");
        }
    }


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("请输入第一个数:");
        int x = in.nextInt();
        System.out.print("请输入第二个数:");
        int y = in.nextInt();
        System.out.print("请输入第三个数:");
        int z = in.nextInt();
        int arr[] = {x, y, z};
        orderNumAsc(arr);
    }
}
